<template>
  <common-page
    ref="commonPage"
    :bg-path="bgPath"
    :web-path="webPath"
    :columns="columns"
    :search-items="searchItems"
    :form-items="formItems"
  />
</template>
<script>
export default {
  data: function() {
    return {
      // ===== ===== ===== ===== 全局属性 ===== ===== ===== =====
      // 后台接口路径
      bgPath: 'health/health/drug/drugplan',
      // Web路径
      webPath: 'health/Health/drug/DrugPlan',
      // ===== ===== ===== ===== 页面配置 ===== ===== ===== =====
      // 搜索内容
      searchItems: [
        {
          rowIndex: 1,
          items: [
            {
              code: "userCode",
              name: "用户编码",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "userName",
              name: "用户名称",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "medCode",
              name: "药品编码",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "medName",
              name: "药品名称",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "takeSign1",
              name: "服用标识1",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "0", value: "不服用" },
                  { key: "1", value: "服用" }
                ]
              }
            },
            {
              code: "mealSign1",
              name: "随餐标识1",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "1", value: "餐前" },
                  { key: "2", value: "随餐" },
                  { key: "3", value: "餐后" }
                ]
              }
            },
            {
              code: "minTakeTime1",
              name: "最早服用时间1",
              span: 6,
              type: "datetime",
              config: {}
            },
            {
              code: "maxTakeTime1",
              name: "最晚服用时间1",
              span: 6,
              type: "datetime",
              config: {}
            },
            {
              code: "takeSign2",
              name: "服用标识2",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "0", value: "不服用" },
                  { key: "1", value: "服用" }
                ]
              }
            },
            {
              code: "mealSign2",
              name: "随餐标识2",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "1", value: "餐前" },
                  { key: "2", value: "随餐" },
                  { key: "3", value: "餐后" }
                ]
              }
            },
            {
              code: "minTakeTime2",
              name: "最早服用时间2",
              span: 6,
              type: "datetime",
              config: {}
            },
            {
              code: "maxTakeTime2",
              name: "最晚服用时间2",
              span: 6,
              type: "datetime",
              config: {}
            },
            {
              code: "takeSign3",
              name: "服用标识3",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "0", value: "不服用" },
                  { key: "1", value: "服用" }
                ]
              }
            },
            {
              code: "mealSign3",
              name: "随餐标识3",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "1", value: "餐前" },
                  { key: "2", value: "随餐" },
                  { key: "3", value: "餐后" }
                ]
              }
            },
            {
              code: "minTakeTime3",
              name: "最早服用时间3",
              span: 6,
              type: "datetime",
              config: {}
            },
            {
              code: "maxTakeTime3",
              name: "最晚服用时间3",
              span: 6,
              type: "datetime",
              config: {}
            },
            {
              code: "takeSign4",
              name: "服用标识4",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "0", value: "不服用" },
                  { key: "1", value: "服用" }
                ]
              }
            },
            {
              code: "mealSign4",
              name: "随餐标识4",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "1", value: "餐前" },
                  { key: "2", value: "随餐" },
                  { key: "3", value: "餐后" }
                ]
              }
            },
            {
              code: "minTakeTime4",
              name: "最早服用时间4",
              span: 6,
              type: "datetime",
              config: {}
            },
            {
              code: "maxTakeTime4",
              name: "最晚服用时间4",
              span: 6,
              type: "datetime",
              config: {}
            },
            {
              code: "takeSign5",
              name: "服用标识5",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "0", value: "不服用" },
                  { key: "1", value: "服用" }
                ]
              }
            },
            {
              code: "mealSign5",
              name: "随餐标识5",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "1", value: "餐前" },
                  { key: "2", value: "随餐" },
                  { key: "3", value: "餐后" }
                ]
              }
            },
            {
              code: "minTakeTime5",
              name: "最早服用时间5",
              span: 6,
              type: "datetime",
              config: {}
            },
            {
              code: "maxTakeTime5",
              name: "最晚服用时间5",
              span: 6,
              type: "datetime",
              config: {}
            },
            {
              code: "takeSign6",
              name: "服用标识6",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "0", value: "不服用" },
                  { key: "1", value: "服用" }
                ]
              }
            },
            {
              code: "mealSign6",
              name: "随餐标识6",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "1", value: "餐前" },
                  { key: "2", value: "随餐" },
                  { key: "3", value: "餐后" }
                ]
              }
            },
            {
              code: "minTakeTime6",
              name: "最早服用时间6",
              span: 6,
              type: "datetime",
              config: {}
            },
            {
              code: "maxTakeTime6",
              name: "最晚服用时间6",
              span: 6,
              type: "datetime",
              config: {}
            }, {
              code: "enableSign",
              name: "启用标识",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "0", value: "不启用" },
                  { key: "1", value: "启用" }
                ]
              }
            }
          ]
        }
      ],
      // 列表内容
      columns: [
        {
          code: "userCode",
          name: "用户编码",
          span: 6,
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "userName",
          name: "用户名称",
          span: 6,
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "medCode",
          name: "药品编码",
          span: 6,
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "medName",
          name: "药品名称",
          span: 6,
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "takeSign1",
          name: "服用标识1",
          span: 6,
          type: "select",
          config: {
            edit: false,
            options: [
              { key: "0", value: "不服用" },
              { key: "1", value: "服用" }
            ]
          }
        },
        {
          code: "mealSign1",
          name: "随餐标识1",
          span: 6,
          type: "select",
          config: {
            edit: false,
            options: [
              { key: "1", value: "餐前" },
              { key: "2", value: "随餐" },
              { key: "3", value: "餐后" }
            ]
          }
        },
        {
          code: "takeTime1",
          name: "服用时间1",
          span: 6,
          type: "datetime",
          config: {}
        },
        {
          code: "takeSign2",
          name: "服用标识2",
          span: 6,
          type: "select",
          config: {
            edit: false,
            options: [
              { key: "0", value: "不服用" },
              { key: "1", value: "服用" }
            ]
          }
        },
        {
          code: "mealSign2",
          name: "随餐标识2",
          span: 6,
          type: "select",
          config: {
            edit: false,
            options: [
              { key: "1", value: "餐前" },
              { key: "2", value: "随餐" },
              { key: "3", value: "餐后" }
            ]
          }
        },
        {
          code: "takeTime2",
          name: "服用时间2",
          span: 6,
          type: "datetime",
          config: {}
        },
        {
          code: "takeSign3",
          name: "服用标识3",
          span: 6,
          type: "select",
          config: {
            edit: false,
            options: [
              { key: "0", value: "不服用" },
              { key: "1", value: "服用" }
            ]
          }
        },
        {
          code: "mealSign3",
          name: "随餐标识3",
          span: 6,
          type: "select",
          config: {
            edit: false,
            options: [
              { key: "1", value: "餐前" },
              { key: "2", value: "随餐" },
              { key: "3", value: "餐后" }
            ]
          }
        },
        {
          code: "takeTime3",
          name: "服用时间3",
          span: 6,
          type: "datetime",
          config: {}
        },
        {
          code: "takeSign4",
          name: "服用标识4",
          span: 6,
          type: "select",
          config: {
            edit: false,
            options: [
              { key: "0", value: "不服用" },
              { key: "1", value: "服用" }
            ]
          }
        },
        {
          code: "mealSign4",
          name: "随餐标识4",
          span: 6,
          type: "select",
          config: {
            edit: false,
            options: [
              { key: "1", value: "餐前" },
              { key: "2", value: "随餐" },
              { key: "3", value: "餐后" }
            ]
          }
        },
        {
          code: "takeTime4",
          name: "服用时间4",
          span: 6,
          type: "datetime",
          config: {}
        },
        {
          code: "takeSign5",
          name: "服用标识5",
          span: 6,
          type: "select",
          config: {
            edit: false,
            options: [
              { key: "0", value: "不服用" },
              { key: "1", value: "服用" }
            ]
          }
        },
        {
          code: "mealSign5",
          name: "随餐标识5",
          span: 6,
          type: "select",
          config: {
            edit: false,
            options: [
              { key: "1", value: "餐前" },
              { key: "2", value: "随餐" },
              { key: "3", value: "餐后" }
            ]
          }
        },
        {
          code: "takeTime5",
          name: "服用时间5",
          span: 6,
          type: "datetime",
          config: {}
        },
        {
          code: "takeSign6",
          name: "服用标识6",
          span: 6,
          type: "select",
          config: {
            edit: false,
            options: [
              { key: "0", value: "不服用" },
              { key: "1", value: "服用" }
            ]
          }
        },
        {
          code: "mealSign6",
          name: "随餐标识6",
          span: 6,
          type: "select",
          config: {
            edit: false,
            options: [
              { key: "1", value: "餐前" },
              { key: "2", value: "随餐" },
              { key: "3", value: "餐后" }
            ]
          }
        },
        {
          code: "takeTime6",
          name: "服用时间6",
          span: 6,
          type: "datetime",
          config: {}
        }, {
          code: "enableSign",
          name: "启用标识",
          span: 6,
          type: "select",
          config: {
            edit: false,
            options: [
              { key: "0", value: "不启用" },
              { key: "1", value: "启用" }
            ]
          }
        }
      ],
      // 增加/修改/详情 表单
      formItems: [
        {
          rowIndex: 1,
          items: [
            {
              code: "userCode",
              span: 6,
              name: "用户编码",
              type: "popup",
              config: {
                url: "base/user/user/user",
                filedList: [
                  { code: 'id', name: 'ID' },
                  { code: 'code', name: '编码' },
                  { code: 'name', name: '名称' }
                ],
                searcher: {},
                defaultValue: "",
                minLength: 0,
                maxLength: 20,
                disabled: false,
                require: true
              },
              handleEvent: {
                /**
                 * 开窗组件被选择
                 * @param code
                 * @param row
                 */
                onPopupClick: (code, row) => {
                  const formData = {
                    userName: row.name,
                    userCode: row.code,
                    userId: row.id
                  }
                  this.$refs.commonPage.updateFormData(formData)
                }
              }
            },
            {
              code: "userName",
              name: "用户名称",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "medCode",
              span: 6,
              name: "药品编码",
              type: "popup",
              config: {
                url: "health/content/content/recipe",
                filedList: [
                  { code: 'id', name: 'ID' },
                  { code: 'code', name: '编码' },
                  { code: 'name', name: '名称' }
                ],
                searcher: {},
                defaultValue: "",
                minLength: 0,
                maxLength: 20,
                disabled: false,
                require: true
              },
              handleEvent: {
                /**
                 * 开窗组件被选择
                 * @param code
                 * @param row
                 */
                onPopupClick: (code, row) => {
                  const formData = {
                    medName: row.name,
                    medCode: row.code,
                    medId: row.id
                  }
                  this.$refs.commonPage.updateFormData(formData)
                }
              }
            },
            {
              code: "medName",
              name: "药品名称",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "takeSign1",
              name: "服用标识1",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "0", value: "不服用" },
                  { key: "1", value: "服用" }
                ]
              }
            },
            {
              code: "mealSign1",
              name: "随餐标识1",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "1", value: "餐前" },
                  { key: "2", value: "随餐" },
                  { key: "3", value: "餐后" }
                ]
              }
            },
            {
              code: "takeTime1",
              name: "服用时间1",
              span: 6,
              type: "datetime",
              config: {}
            },
            {
              code: "takeSign2",
              name: "服用标识2",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "0", value: "不服用" },
                  { key: "1", value: "服用" }
                ]
              }
            },
            {
              code: "mealSign2",
              name: "随餐标识2",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "1", value: "餐前" },
                  { key: "2", value: "随餐" },
                  { key: "3", value: "餐后" }
                ]
              }
            },
            {
              code: "takeTime2",
              name: "服用时间2",
              span: 6,
              type: "datetime",
              config: {}
            },
            {
              code: "takeSign3",
              name: "服用标识3",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "0", value: "不服用" },
                  { key: "1", value: "服用" }
                ]
              }
            },
            {
              code: "mealSign3",
              name: "随餐标识3",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "1", value: "餐前" },
                  { key: "2", value: "随餐" },
                  { key: "3", value: "餐后" }
                ]
              }
            },
            {
              code: "takeTime3",
              name: "服用时间3",
              span: 6,
              type: "datetime",
              config: {}
            },
            {
              code: "takeSign4",
              name: "服用标识4",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "0", value: "不服用" },
                  { key: "1", value: "服用" }
                ]
              }
            },
            {
              code: "mealSign4",
              name: "随餐标识4",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "1", value: "餐前" },
                  { key: "2", value: "随餐" },
                  { key: "3", value: "餐后" }
                ]
              }
            },
            {
              code: "takeTime4",
              name: "服用时间4",
              span: 6,
              type: "datetime",
              config: {}
            },
            {
              code: "takeSign5",
              name: "服用标识5",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "0", value: "不服用" },
                  { key: "1", value: "服用" }
                ]
              }
            },
            {
              code: "mealSign5",
              name: "随餐标识5",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "1", value: "餐前" },
                  { key: "2", value: "随餐" },
                  { key: "3", value: "餐后" }
                ]
              }
            },
            {
              code: "takeTime5",
              name: "服用时间5",
              span: 6,
              type: "datetime",
              config: {}
            },
            {
              code: "takeSign6",
              name: "服用标识6",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "0", value: "不服用" },
                  { key: "1", value: "服用" }
                ]
              }
            },
            {
              code: "mealSign6",
              name: "随餐标识6",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "1", value: "餐前" },
                  { key: "2", value: "随餐" },
                  { key: "3", value: "餐后" }
                ]
              }
            },
            {
              code: "takeTime6",
              name: "服用时间6",
              span: 6,
              type: "datetime",
              config: {}
            }, {
              code: "enableSign",
              name: "启用标识",
              span: 6,
              type: "select",
              config: {
                edit: false,
                options: [
                  { key: "0", value: "不启用" },
                  { key: "1", value: "启用" }
                ]
              }
            }
          ]
        }
      ]
    }
  }
}
</script>
